<template>
  <el-container>
    <el-header height="1">
      <venus-steps
        :active="step.active"
        :step-data="step.stepData"
      />
    </el-header>
    <el-main>
      <el-form ref="updateForm" size="small" :model="parmsValue.update" label-width="180px" :rules="form.rules" class="middle-form">
        <!--产品模板基本信息开始-->
        <div v-show="step.active === 1">
          <el-row>
            <el-col :span="8">
              <el-form-item prop="t8_prod_series_id" label="产品系列">
                <el-select v-model="parmsValue.update.t8_prod_series_id" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.prodModelGetSeries" :key="index" :value="item.id" :label="item.id+'-'+item.prod_series_name" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="trustee_id" label="托管行">
                <el-select v-model="parmsValue.update.trustee_id" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.selectTrusteeInfo" :key="index" :value="item.id+''" :label="item.id+'-'+item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="pmod_name" label="模板名称">
                <el-input v-model="parmsValue.update.pmod_name" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="prod_doc_templates" label="产品文档">
                <el-select v-model="parmsValue.update.prod_doc_templates" multiple :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.QUERYTEMPBYTEMPTYPE" :key="index" :value="item.value+''" :label="item.value+'-'+item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="prod_mod" label="产品模式">
                <el-select v-model="parmsValue.update.prod_mod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_prod_model" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="acct_mod" label="核算方式">
                <el-select v-model="parmsValue.update.acct_mod" :clearable="true" :disabled="detailMod || updateMod">
                  <el-option v-for="(item,index) in dict.t8_busi_account_type" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="income_type" label="收益特点">
                <el-select v-model="parmsValue.update.income_type" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_income_attr" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="issu_ccy" label="募集币种">
                <el-select v-model="parmsValue.update.issu_ccy" :clearable="true" :disabled="detailMod || updateMod">
                  <el-option v-for="(item,index) in dict.t8_currtype" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="invest_cuy" label="投资币种">
                <el-select v-model="parmsValue.update.invest_cuy" :clearable="true" :disabled="detailMod || updateMod">
                  <el-option v-for="(item,index) in dict.t8_currtype" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="risk_lev" label="产品风险等级">
                <el-select v-model="parmsValue.update.risk_lev" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_prod_risk_level" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="invest_object" label="投资者类型">
                <el-select v-model="parmsValue.update.invest_object" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_sale_oside" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="basedays" label="计息基数">
                <el-select v-model="parmsValue.update.basedays" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_intr_base" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!shareBonusTypeHide" :span="8">
              <el-form-item prop="sharebonus_type" label="分红方式">
                <el-select v-model="parmsValue.update.sharebonus_type" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.def_div_method" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="yield_banding_desc" label="收益率分档情况说明">
                <el-input v-model="parmsValue.update.yield_banding_desc" type="textarea" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
            <el-col :span="8">
              <el-form-item prop="is_structprod" label="是否为结构化(分级)产品">
                <el-select v-model="parmsValue.update.is_structprod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_1yes0no" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="level_type" label="层级类别">
                <el-select v-model="parmsValue.update.level_type" :clearable="true" :disabled="detailMod || updateMod">
                  <el-option v-for="(item,index) in dict.t8_level_type" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" />
          </el-row>
          <div class="form-line" />
          <el-row>
            <el-col v-if="!(mergeCloseProd || mergeOpenProd || onlyMerge)" :span="8">
              <el-form-item prop="min_subs_p" label="认购起点金额(元/个人)">
                <el-input v-model="parmsValue.update.min_subs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(mergeCloseProd || mergeOpenProd || onlyMerge)" :span="8">
              <el-form-item prop="step_subs_p" label="认购递增金额(元/个人)">
                <el-input v-model="parmsValue.update.step_subs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(mergeCloseProd || mergeOpenProd || onlyMerge)" :span="8">
              <el-form-item prop="max_subs_p" label="认购最高金额(元/个人)">
                <el-input v-model="parmsValue.update.max_subs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!(mergeCloseProd || mergeOpenProd || onlyMerge)" :span="8">
              <el-form-item prop="max_buy_p" label="累计购买金额上限(元/个人)">
                <el-input v-model="parmsValue.update.max_buy_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || personOpenProd || onlyPerson)" :span="8">
              <el-form-item prop="min_subs_m" label="认购起点金额(元/机构)">
                <el-input v-model="parmsValue.update.min_subs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || personOpenProd || onlyPerson)" :span="8">
              <el-form-item prop="step_subs_m" label="认购递增金额(元/机构)">
                <el-input v-model="parmsValue.update.step_subs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!(personCloseProd || personOpenProd || onlyPerson)" :span="8">
              <el-form-item prop="max_subs_m" label="认购最高金额(元/机构)">
                <el-input v-model="parmsValue.update.max_subs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || personOpenProd || onlyPerson)" :span="8">
              <el-form-item prop="max_buy_m" label="累计购买金额上限(元/机构)">
                <el-input v-model="parmsValue.update.max_buy_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
          </el-row>
          <div class="form-line" />
          <el-row>
            <el-col v-if="!(personCloseProd || mergeOpenProd || mergeCloseProd || onlyMerge || allCloseProd)" :span="8">
              <el-form-item prop="min_pchs_p" label="申购起点金额(元/个人)">
                <el-input v-model="parmsValue.update.min_pchs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || mergeOpenProd || mergeCloseProd || onlyMerge || allCloseProd)" :span="8">
              <el-form-item prop="step_pchs_p" label="申购递增金额(元/个人)">
                <el-input v-model="parmsValue.update.step_pchs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || mergeOpenProd || mergeCloseProd || onlyMerge || allCloseProd)" :span="8">
              <el-form-item prop="max_pchs_p" label="申购最高金额(元/个人)">
                <el-input v-model="parmsValue.update.max_pchs_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!(personCloseProd || mergeOpenProd || mergeCloseProd || onlyMerge || allCloseProd)" :span="8">
              <el-form-item prop="min_hold_p" label="最低持有份额(份/个人)">
                <el-input v-model="parmsValue.update.min_hold_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(personCloseProd || mergeOpenProd || mergeCloseProd || onlyMerge || allCloseProd)" :span="8">
              <el-form-item prop="min_redeem_p" label="单笔赎回最低份额(份/个人)">
                <el-input v-model="parmsValue.update.min_redeem_p" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!(onlyPerson || personOpenProd || mergeCloseProd || personCloseProd || allCloseProd)" :span="8">
              <el-form-item prop="min_pchs_m" label="申购起点金额(元/机构)">
                <el-input v-model="parmsValue.update.min_pchs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(onlyPerson || personOpenProd || mergeCloseProd || personCloseProd || allCloseProd)" :span="8">
              <el-form-item prop="step_pchs_m" label="申购递增金额(元/机构)">
                <el-input v-model="parmsValue.update.step_pchs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(onlyPerson || personOpenProd || mergeCloseProd || personCloseProd || allCloseProd)" :span="8">
              <el-form-item prop="max_pchs_m" label="申购最高金额(元/机构)">
                <el-input v-model="parmsValue.update.max_pchs_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col v-if="!(onlyPerson || personOpenProd || mergeCloseProd || personCloseProd || allCloseProd)" :span="8">
              <el-form-item prop="min_hold_m" label="最低持有份额(份/机构)">
                <el-input v-model="parmsValue.update.min_hold_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col v-if="!(onlyPerson || personOpenProd || mergeCloseProd || personCloseProd || allCloseProd)" :span="8">
              <el-form-item prop="min_redeem_m" label="单笔赎回最低份额(份/机构)">
                <el-input v-model="parmsValue.update.min_redeem_m" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <!--产品模板基本信息结束-->
        <!--中债登报备数据元开始-->
        <div v-show="step.active === 2">
          <el-row>
            <el-col :span="8">
              <el-form-item prop="author_name" label="产品审批人">
                <el-select v-model="parmsValue.update.author_name" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.getProdSeriesByType2" :key="index" :value="item.value" :label="item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="author_identif" label="审批人证件号码">
                <el-input v-model="parmsValue.update.author_identif" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="design_name" label="产品设计人">
                <el-select v-model="parmsValue.update.design_name" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.getProdSeriesByType3" :key="index" :value="item.value" :label="item.text" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="design_identif" label="设计人证件号码">
                <el-input v-model="parmsValue.update.design_identif" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="manage_name" label="投资经理">
                <el-select v-model="parmsValue.update.manage_name" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.getProdSeriesByType1" :key="index" :value="item.value" :label="item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="manage_identif" label="投资经理证件号码">
                <el-input v-model="parmsValue.update.manage_identif" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="saleman_name" label="产品联络人">
                <el-select v-model="parmsValue.update.saleman_name" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.getProdSeriesByType5" :key="index" :value="item.value" :label="item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="saleman_phoneno" label="产品联络人座机">
                <el-input v-model="parmsValue.update.saleman_phoneno" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="saleman_telno" label="产品联络人手机号">
                <el-input v-model="parmsValue.update.saleman_telno" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="saleman_email" label="产品联络人邮箱">
                <el-input v-model="parmsValue.update.saleman_email" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="sale_place" label="资金投向地">
                <el-select v-model="parmsValue.update.sale_place" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_sale_place" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="sale_place_name" label="产品投资国家或地区">
                <el-select v-model="parmsValue.update.sale_place_name" :clearable="true" :disabled="detailMod || updateMod">
                  <el-option v-for="(item,index) in dict.t8_sale_place_name" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="manage_mode" label="产品管理模式">
                <el-select v-model="parmsValue.update.manage_mode" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_manage_mode" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="admin_name" label="实际管理人名称">
                <el-input v-model="parmsValue.update.admin_name" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="asset_maping" label="产品资产配置模式">
                <el-select v-model="parmsValue.update.asset_maping" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_asset_maping" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="pricing_type" label="产品定价方式">
                <el-select v-model="parmsValue.update.pricing_type" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_pricing_type" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="structprod_subject" label="结构性产品挂钩标的">
                <el-select v-model="parmsValue.update.structprod_subject" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_structprod_subject" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="cooperation_mode" label="合作模式">
                <el-select v-model="parmsValue.update.cooperation_mode" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_cooperation_mode" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="cooperation_org_name" label="合作机构名称">
                <el-input v-model="parmsValue.update.cooperation_org_name" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="return_cost" label="投资本金到账日">
                <el-select v-model="parmsValue.update.return_cost" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_return_cost" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="return_income" label="投资收益到账日">
                <el-select v-model="parmsValue.update.return_income" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_return_cost" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="prod_credit_flag" label="产品增信标识">
                <el-select v-model="parmsValue.update.prod_credit_flag" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_is_not2" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="prod_credit_org" label="产品增信机构">
                <el-select v-model="parmsValue.update.prod_credit_org" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_credit_org" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="prod_credit_mod" label="产品增信形式">
                <el-select v-model="parmsValue.update.prod_credit_mod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_zhz_up_credit" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="prod_brand" label="产品品牌">
                <el-input v-model="parmsValue.update.prod_brand" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="return_ccy" label="兑付本金币种">
                <el-select v-model="parmsValue.update.return_ccy" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_currtype" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="income_ccy" label="兑付收益币种">
                <el-select v-model="parmsValue.update.income_ccy" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_currtype" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="prod_precent" label="投资资产种类及比例">
                <el-input v-model="parmsValue.update.prod_precent" :clearable="true" :disabled="detailMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8" />
          </el-row>
        </div>
        <!--中债登报备数据元结束-->

        <!--产品报备数据开始-->
        <div v-show="step.active === 3">
          <el-row>
            <el-col :span="8">
              <el-form-item prop="trustee_code" label="境内托管机构代码">
                <el-select v-model="parmsValue.update.trustee_id" :clearable="true" :disabled="true">
                  <el-option v-for="(item,index) in dict.selectTrusteeInfo" :key="index" :value="item.id+''" :label="item.value" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="trustee_name1" label="境内托管机构名称">
                <el-select v-model="parmsValue.update.trustee_id" :clearable="true" :disabled="true">
                  <el-option v-for="(item,index) in dict.selectTrusteeInfo" :key="index" :value="item.id+''" :label="item.text" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="oper_mod" label="管理方式">
                <el-select v-model="parmsValue.update.oper_mod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_reserve6" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="coll_mod" label="募集方式">
                <el-select v-model="parmsValue.update.coll_mod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_reserve4" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="busi_mod" label="业务模式">
                <el-select v-model="parmsValue.update.busi_mod" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_reserve7" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="safe_rate" label="收益保证标识">
                <el-select v-model="parmsValue.update.safe_rate" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_1yes0no" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="safe_capit" label="本金保障标识">
                <el-select v-model="parmsValue.update.safe_capit" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_1yes0no" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="term_flag" label="可提前终止标识">
                <el-select v-model="parmsValue.update.term_flag" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_1yes0no" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="redeem_flag" label="可赎回权标识">
                <el-select v-model="parmsValue.update.redeem_flag" :clearable="true" :disabled="detailMod">
                  <el-option v-for="(item,index) in dict.t8_1yes0no" :key="index" :value="index" :label="item" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item prop="trustee_country_name" label="境外托管机构国别">
                <el-input v-model="parmsValue.update.trustee_country_name" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item prop="overs_trustee_name" label="境外托管机构名称">
                <el-input v-model="parmsValue.update.overs_trustee_name" :clearable="true" :disabled="detailMod || updateMod" />
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <!--产品报备数据结束-->
        <el-row>
          <el-button v-show="step.active > 1" type="success" size="small" @click="before">上一步</el-button>
          <el-button v-show="step.active < step.stepData.length" type="success" size="small" @click="next">下一步</el-button>
          <el-button v-show="step.active === step.stepData.length" v-if="!detailMod" size="small" type="success" @click="save">提交</el-button>
          <el-button size="small" type="info" @click="closePage">返回</el-button>
        </el-row>
      </el-form>
    </el-main>
  </el-container>
</template>

<script>
  import { formItems } from '@/utils/formItems'
  import * as kk from '@/utils/k-utils'
  import request from '@/utils/request'
  import axios from 'axios'

  export default {
    name: 'BaseProdModel',
    props: {
      editMod: {
        type: String,
        default: 'detail'
      }
    },
    data() {
      return {
        dict: {
          t8_level_type: {},
          t8_structprod_subject: {},
          t8_sale_place_name: {},
          t8_zhz_srv_mode: {},
          prodModelGetSeries: {},
          selectTrusteeInfo: {},
          QUERYTEMPBYTEMPTYPE: {},
          getProdSeriesByType2: {},
          getProdSeriesByType3: {},
          getProdSeriesByType1: {},
          getProdSeriesByType5: {},
          t8_prod_model: {},
          t8_busi_account_type: {},
          t8_income_attr: {},
          t8_currtype: {},
          t8_prod_risk_level: {},
          t8_sale_oside: {},
          t8_intr_base: {},
          def_div_method: {},
          t8_1yes0no: {},
          t8_zhz_sale_place: {},
          t8_zhz_asset_maping: {},
          t8_zhz_manage_mode: {},
          t8_zhz_pricing_type: {},
          t8_zhz_cooperation_mode: {},
          t8_zhz_return_cost: {},
          t8_zhz_is_not2: {},
          t8_zhz_credit_org: {},
          t8_zhz_up_credit: {},
          t8_reserve6: {},
          t8_reserve7: {},
          t8_reserve4: {}
        },
        step: {
          active: 1,
          stepData: ['产品模板基本信息', '中债登报备数据元', '产品报备数据']
        },
        form: {
          rules: {
            t8_prod_series_id: [{ required: true, message: '产品系列必选', trigger: 'change' }],
            trustee_id: [{ required: true, message: '托管行必选', trigger: 'change' }],
            pmod_name: [{ required: true, message: '模板名称必选', trigger: 'change' }],
            prod_mod: [{ required: true, message: '产品模式必选', trigger: 'change' }],
            acct_mod: [{ required: true, message: '核算方式必选', trigger: 'change' }],
            income_type: [{ required: true, message: '收益特点必选', trigger: 'change' }],
            issu_ccy: [{ required: true, message: '募集币种必选', trigger: 'change' }],
            invest_cuy: [{ required: true, message: '投资币种必选', trigger: 'change' }],
            risk_lev: [{ required: true, message: '产品风险等级必选', trigger: 'change' }],
            invest_object: [{ required: true, message: '投资者类型必选', trigger: 'change' }],
            basedays: [{ required: true, message: '计息基数必选', trigger: 'change' }],
            sharebonus_type: [{ required: true, message: '分红方式必选', trigger: 'change' }],
            is_structprod: [{ required: true, message: '是否为结构化(分级)产品必选', trigger: 'change' }],
            min_subs_p: [{ required: true, message: '认购起点金额必填', trigger: 'change' }],
            step_subs_p: [{ required: true, message: '认购递增金额必填', trigger: 'change' }],
            min_subs_m: [{ required: true, message: '认购起点金额必填', trigger: 'change' }],
            step_subs_m: [{ required: true, message: '认购递增金额必填', trigger: 'change' }],
            saleman_name: [{ required: true, message: '产品联络人必选', trigger: 'change' }],
            sale_place: [{ required: true, message: '资金投向地必选', trigger: 'change' }],
            manage_mode: [{ required: true, message: '产品管理模式必选', trigger: 'change' }],
            // admin_name: [{ required: true, message: '实际管理人名称必选', trigger: 'change' }],
            asset_maping: [{ required: true, message: '产品资产配置模式必选', trigger: 'change' }],
            cooperation_mode: [{ required: true, message: '合作模式必选', trigger: 'change' }],
            return_cost: [{ required: true, message: '投资本金到账日必选', trigger: 'change' }],
            return_income: [{ required: true, message: '投资收益到账日必选', trigger: 'change' }],
            prod_credit_flag: [{ required: true, message: '产品增信标识必选', trigger: 'change' }],
            prod_precent: [{ required: true, message: '投资资产种类及比例必选', trigger: 'change' }],
            oper_mod: [{ required: true, message: '管理方式必选', trigger: 'change' }],
            coll_mod: [{ required: true, message: '募集方式必选', trigger: 'change' }],
            term_flag: [{ required: true, message: '可提前终止标识必选', trigger: 'change' }],
            redeem_flag: [{ required: true, message: '可赎回权标识必选', trigger: 'change' }]
          }
        },
        parmsValue: {
          query: {
            name: '',
            code: ''
          },
          update: {
            t8_prod_series_id: '',
            trustee_id: '',
            pmod_name: '',
            prod_doc_templates: '',
            prod_mod: '',
            acct_mod: '',
            income_type: '',
            issu_ccy: '',
            invest_cuy: '',
            risk_lev: '',
            invest_object: '',
            basedays: '',
            sharebonus_type: '',
            yield_banding_desc: '',
            is_structprod: '',
            is_structdeposit: '',
            level_type: '',
            min_subs_p: '',
            step_subs_p: '',
            max_subs_p: '',
            max_buy_p: '',
            min_subs_m: '',
            step_subs_m: '',
            max_subs_m: '',
            max_buy_m: '',
            min_pchs_p: '',
            step_pchs_p: '',
            max_pchs_p: '',
            min_hold_p: '',
            min_redeem_p: '',
            min_pchs_m: '',
            step_pchs_m: '',
            max_pchs_m: '',
            min_hold_m: '',
            min_redeem_m: '',
            author_name: '',
            author_identif: '',
            design_name: '',
            design_identif: '',
            manage_name: '',
            manage_identif: '',
            saleman_name: '',
            saleman_phoneno: '',
            saleman_telno: '',
            saleman_email: '',
            sale_place: '',
            sale_place_name: '',
            srv_mode: '',
            manage_mode: '',
            admin_name: '',
            asset_maping: '',
            pricing_type: '',
            structprod_subject: '',
            cooperation_mode: '',
            cooperation_org_name: '',
            return_cost: '',
            return_income: '',
            prod_credit_flag: '',
            prod_credit_org: '',
            prod_credit_mod: '',
            prod_brand: '',
            return_ccy: '',
            income_ccy: '',
            prod_precent: '',
            trustee_code: '',
            trustee_name1: '',
            oper_mod: '',
            coll_mod: '',
            busi_mod: '',
            safe_rate: '',
            safe_capit: '',
            term_flag: '',
            redeem_flag: '',
            trustee_country_name: '',
            overs_trustee_name: ''
          }
        }
      }
    },
    computed: {
      updateMod() {
        return this.editMod === 'update'
      },
      detailMod() {
        return this.editMod === 'detail'
      },
      addMod() {
        return this.editMod === 'add'
      },
      // 控制金额部分字段显示隐藏
      shareBonusTypeHide() {
        return this.parmsValue.update.prod_mod === '1' || this.parmsValue.update.prod_mod === '2'
      },
      personOpenProd() {
        return (this.parmsValue.update.invest_object === '01' || this.parmsValue.update.invest_object === '03') &&
          (this.parmsValue.update.prod_mod === '1' || this.parmsValue.update.prod_mod === '4' || this.parmsValue.update.prod_mod === '6')
      },
      mergeOpenProd() {
        return (this.parmsValue.update.invest_object === '02' || this.parmsValue.update.invest_object === '04') &&
          (this.parmsValue.update.prod_mod === '1' || this.parmsValue.update.prod_mod === '4' || this.parmsValue.update.prod_mod === '6')
      },
      allOpenProd() {
        return this.parmsValue.update.invest_object === '-1' &&
          (this.parmsValue.update.prod_mod === '-1' || this.parmsValue.update.prod_mod === '4' || this.parmsValue.update.prod_mod === '6')
      },
      personCloseProd() {
        return (this.parmsValue.update.invest_object === '01' || this.parmsValue.update.invest_object === '03') &&
          (this.parmsValue.update.prod_mod === '2' || this.parmsValue.update.prod_mod === '5')
      },
      mergeCloseProd() {
        return (this.parmsValue.update.invest_object === '02' || this.parmsValue.update.invest_object === '04') &&
          (this.parmsValue.update.prod_mod === '2' || this.parmsValue.update.prod_mod === '5')
      },
      allCloseProd() {
        return (this.parmsValue.update.invest_object === '-1') &&
          (this.parmsValue.update.prod_mod === '2' || this.parmsValue.update.prod_mod === '5')
      },
      onlyPerson() {
        return !this.parmsValue.update.prod_mod && (this.parmsValue.update.invest_object === '01' || this.parmsValue.update.invest_object === '03')
      },
      onlyMerge() {
        return !this.parmsValue.update.prod_mod && (this.parmsValue.update.invest_object === '02' || this.parmsValue.update.invest_object === '04')
      }
    },
    // 生命周期开始
    activated() {
      this.resetFields('updateForm')
      this.step.active = 1
      this.init()

      if (!this.addMod) {
        const prodModelData = this.$route.query.params
        this.parmsValue.update = JSON.parse(prodModelData)
        this.reverseHandleData()
      }
    },
    // 生命周期结束
    methods: {
      resetFields(form) {
        this.$refs[form].resetFields()
      },
      next() {
        if (this.step.active < this.step.stepData.length) {
          this.step.active++
        }
      },
      before() {
        if (this.step.active > 1) {
          this.step.active--
        }
      },
      init() {
        const exeidReq = []
        const exeids = [
          { service: formItems.PROD, params: { exeid: 'prodModelGetSeries' }},
          { service: formItems.ORG, params: { exeid: 'selectTrusteeInfo' }},
          { service: formItems.FILE, params: { exeid: 'QUERYTEMPBYTEMPTYPE', temp_type: 2 }},
          { service: formItems.PROD, dict: 'getProdSeriesByType3', params: { exeid: 'getProdSeriesByType', cust_type: '03' }},
          { service: formItems.PROD, dict: 'getProdSeriesByType1', params: { exeid: 'getProdSeriesByType', cust_type: '01' }},
          { service: formItems.PROD, dict: 'getProdSeriesByType2', params: { exeid: 'getProdSeriesByType', cust_type: '02' }},
          { service: formItems.PROD, dict: 'getProdSeriesByType5', params: { exeid: 'getProdSeriesByType', cust_type: '05' }}
        ]
        exeids.forEach(item => exeidReq.push(request({
          url: '/' + item.service + '/base/comn-query.json', method: 'post', loading: true, params: item.params
        })))
        axios.all(exeidReq).then(axios.spread((...items) => {
          for (let i = 0; i < exeids.length; i++) {
            if (exeids[i].dict) {
              this.dict[exeids[i].dict] = items[i].rows
            } else {
              this.dict[exeids[i].params.exeid] = items[i].rows
            }
          }
        }))

        const dictReq = []
        const dicts = [
          't8_level_type', 't8_structprod_subject', 't8_sale_place_name', 't8_zhz_srv_mode', 't8_currtype', 't8_prod_risk_level', 't8_sale_oside',
          't8_intr_base', 'def_div_method', 't8_1yes0no', 't8_zhz_sale_place', 't8_zhz_asset_maping',
          't8_zhz_manage_mode', 't8_zhz_pricing_type', 't8_zhz_cooperation_mode', 't8_zhz_return_cost', 't8_zhz_is_not2', 't8_income_attr',
          't8_zhz_credit_org', 't8_zhz_up_credit', 't8_reserve6', 't8_reserve4', 't8_reserve7', 't8_prod_model', 't8_busi_account_type']
        dicts.forEach(key => dictReq.push(request({ url: 'system/base/dict/' + key + '.json', method: 'post', loading: true })))
        axios.all(dictReq).then(axios.spread((...items) => {
          for (let i = 0; i < dicts.length; i++) {
            this.dict[dicts[i]] = items[i]
          }
        }))
      },
      /**
       * 保存更新
       */
      save() {
        this.$refs['updateForm'].validate((valid, object) => {
          if (valid) {
            let exeid = 'updateModelInfo'
            if (this.addMod) {
              exeid = 'insertProdModel'
            }

            this.handleData()
            kk.k_update_exeid(formItems.PROD, exeid, this.parmsValue.update).then(resp => {
              if (resp.success) {
                kk.k_close_self_page()
              }
            })
          } else {
            const validateField = Object.keys(object)
            if (validateField.length > 0) {
              this.$message.warning(object[validateField[0]][0].message)
            }
          }
        })
      },
      closePage() {
        kk.k_close_self_page()
      },
      handleData() {
        this.parmsValue.update.prod_doc_templates = this.parmsValue.update.prod_doc_templates.join(',')
      },
      reverseHandleData() {
        this.parmsValue.update.prod_doc_templates = this.parmsValue.update.prod_doc_templates.split(',')
      }
    }
  }

</script>
